<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1" import="com.IUT.biblio.model.*" import="java.util.HashMap"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Ajout d'un exemplaire</title>
<style type="text/css">
<%@include file="design.css" %>
</style>
</head>
<body>
	<%@include file="entete.html" %>
	<%@include file="menu.html" %>

	<div id="contenu">
		
		<% 
		ServletContext context = getServletContext();
		Bibliotheque bibli = (Bibliotheque)context.getAttribute("biblio");
		if(bibli.nbOuv()!=0){ %>
			<form method="post" action="ex.do">
			<div class="box">
					<h1>Ajout d'un exemplaire</h1>
					<input type="hidden" name="actForm" value="ajoutEx" />
					<label >
						<span>ISBN de l'ouvrage</span>
						<select class="input_text" name="isbn">
							<%
							HashMap<String, Ouvrage> lesOuvrages = bibli.getOuvrages();
							String isbn=(String)request.getAttribute("id");
							
							for(String num : lesOuvrages.keySet()) {
								out.println("<option value=\""+ num+"\">"+num+"</option>");
							}	
							%>
						</select>
					</label>
					<label>
						<span>Date de reception(JJ/MM/AAAA)</span>
						<input class="date2" type="text" name="dateJ" size="2" maxlength="2"/> /
						<input class="date2" type="text" name="dateM" size="2" maxlength="2"/> /
						<input class="date4" type="text" name="dateA" size="4" maxlength="4"/>
					</label>
					
					<input class="button" type="submit" value="Envoyer"/>				
				
				</div>
			</form>
			<%
		}
			else{	
		%>
		<h1>Ajout d'un exemplaire</h1>
		<p><strong>Il faut d'abord ajouter un ouvrage.</strong></p>
		<%} %>
		
		<p><a href="/Biblio">Retour</a></p>
	</div>
	
	<div id="footer">
		<p>Exercice d'application JEE. </p>
	</div>
		
</body>
</html>